<template>
  <div>
    <el-row :gutter="20">

      <el-table v-loading="loading" :data="tableData">
        <el-table-column label="标签ID" width="120" align="center" prop="tagId"/>
        <el-table-column label="标签内容" align="left" width="120" prop="tagName" :show-overflow-tooltip="true"/>
        <el-table-column label="模型产出" align="center" prop="llmValue" :show-overflow-tooltip="true"/>
        <el-table-column label="专员审核结果" align="center" prop="officerValue" :show-overflow-tooltip="true"/>
        <el-table-column label="专家审核结果" align="center" prop="expertValue" :show-overflow-tooltip="true"/>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />

    </el-row>
  </div>
</template>

<script>
import {getPolicyTag} from '@/api/policy/policyTag'
import policy from "./index.vue";
export default {
  name: "PolicyTagTable",
  data() {
    return {
      loading: false,
      tableData: [],
      queryParams: {
        policyId: undefined,
        pageNum: 1,
        pageSize: 10,
      },
      total: 0,
    }
  },
  props: ['policy'],
  mounted () {},
  methods: {
    getList() {
      getPolicyTag(this.queryParams).then(
        response => {
          this.tableData = response.rows.map(item => {
            item.coreIds = item.coreIds?.split(',') ?? [];
            return item;
          })
          this.total = response.total;
          this.loading = false;
        }
      )
    },
  },
  watch: {
    policy: {
      handler (val)  {
        if (val.policyId) {
          this.queryParams.policyId = val.policyId
          this.getList()
        }
      },
      immediate: true
    }
  }
}
</script>

<style scoped lang="scss">

</style>
